home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-10-26 | 3.2 KB | 145 lines | [TEXT/MACA] |
- : ** ;
-
- : actFW enable: menubar
- 4 1 do i enable: filemen loop
- decimal initFont
- ;
-
- 0 value part#
-
- :CLASS vsBar <super object
-
- rect vsRect
- var wPtr
- Handle ctlHndl
-
- \ initializes the scrollbar rectangle from the port rectangle
- :M PUTRECT: ( wPtr -- )
- put: wPtr
- getRect: [ get: wPtr ]
- 2swap swap drop
- 3 pick 16 -
- swap 2swap
- put: vsRect
- ;M
-
- \ instantiates vertical scrollbar in window, returning handle in ctlHndl
- :M NEW: ( -- )
- 0 \ room for ctlHandle returned
- get: wPtr +base \ window pointer
- abs: vsRect \ scrollbar bounds rectangle
- nullOSstr \ null Str255
- 256 makeint \ visible
- 0 makeint \ value
- 0 makeint \ min
- 0 makeint \ max
- 16 makeint \ procID for scrollbars
- 0 \ refCon
- call NewControl
- put: ctlHndl
- ;M
-
-
- \ disposes of heap storage for the scrollbars
- :M KILL: ( -- ) get: ctlHndl call DisposControl ;M
-
-
- \ draws scrollbars on update events
- :M DRAW: ( -- ) get: wPtr +base call DrawControls ;M
-
- \ hilites the given part number
- :M HILITE: { thePart -- } get: ctlHndl thePart makeint call HiliteControl ;M
-
- :M PUTMIN: ( min -- ) get: ctlHndl swap makeint call SetMinCtl ;M
- :M GETMIN: ( -- min ) word0 get: ctlHndl call GetMinCtl I->L ;M
-
- :M PUTMAX: ( max -- ) get: ctlHndl swap makeint call SetMaxCtl ;M
- :M GETMAX: ( -- max ) word0 get: ctlHndl call GetMaxCtl I->L ;M
-
- :M PUTVAL: ( val -- ) get: ctlHndl swap makeint call SetCtlVal ;M
- :M GETVAL: ( -- val ) word0 get: ctlHndl call GetCtlVal I->L ;M
-
- \ tests to see which part got hit and returns 0 or partcode in part#
- :M TEST: ( -- ) word0 get: ctlHndl where: fevent G->L
- call TestControl I->L -> part# ;M
-
- \ tracks the mouse, executing part handler's default procedure while mousedown
- :M TRACK: ( -- partNumber or 0 on mouse-up )
- word0 \ space for INT result
- get: ctlHndl
- where: fevent G->L \ mouse point in local coordinates
- -1
- call TrackControl
- I->L
- ;M
-
- ;CLASS
-
- window edWind
- vsBar edBar
-
- \ close activate draw content handlers
- : fix <[ 4 ]> 'cfas null actFW cr null actions: fwind
- close: edWind cls ;
-
- : ok? depth . depth 0 > if . then rdepth . mdepth . ;
-
- \ define scrollbar handlers
- : showValue 100 50 gotoxy getVal: edBar . ;
- : PUp getVal: edBar 5 - putVal: edBar showValue ;
- : PDn getVal: edBar 5 + putVal: edBar showValue ;
- : LUp getVal: edBar 1 - putVal: edBar showValue ;
- : LDn getVal: edBar 1 + putVal: edBar showValue ;
- : doThumb track: edBar drop showValue ;
-
- : doPart ( part# -- )
- case 20 of LUp endof
- 21 of LDn endof
- 22 of PUp endof
- 23 of PDn endof
- 129 of doThumb endof
- drop
- endcase
- ;
-
- : makeEd false setDrag: EdWind
- false setGrow: EdWind
- 2 241 510 340 put: tempRect
- tempRect " ed" 0 true false new: EdWind
- ;
-
- : drawAll draw: EdBar ;
-
- : contEd
- test: EdBar
- part#
- if part# hilite: edBar
- begin stilldown? while
- part# doPart
- repeat
- 0 hilite: edBar
- then
- ;
-
- : actF become actFW cls ;
-
- : actEd begin
- next: fevent
- if 2drop then
- again
- ;
-
- \ close activate draw content
- \ instantiate both windows & bar and display bar
- : test makeEd
- set: EdWind -curs
- addr: edWind putRect: edBar \ setup vsRect from owning window
- new: edBar
- 0 putMin: edBar 100 putMax: edBar
- 0 putVal: edBar draw: edBar
- <[ 4 ]> 'cfas null actEd drawAll contEd actions: edWind
- <[ 4 ]> 'cfas null actF null null actions: fWind
- ;
-
-
-